<template>
	<view class="home">
		<swiper indicator-dots circular >
			<swiper-item v-for="item in swipers" :key="item.id">
				<image :src="item.img" mode="widthFix"></image>
			</swiper-item>
		</swiper>
		<!-- 导航区域 -->
		<view class="nav">
			<view class="nav_item">
				<view class="iconfont icon-ziyuan">
					<text>9.9包邮</text>
				</view>
			</view>
			<view class="nav_item">
				<view class="iconfont icon-guanyuwomen">
					<text>联系我们</text>
				</view>
			</view>
			<view class="nav_item">
				<view class="iconfont icon-tupian">
					<text>社区图片</text>
				</view>
			</view>
			<view class="nav_item">
				<view class="iconfont icon-shipin">
					<text>学习视频</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				swipers: []
			}
		},
		onLoad() {
			this.getSwipers();
		},
		methods: {
			// 获取轮播图
		async getSwipers(){
			const res = await this.$myRequest({
					url:'/api/getlunbo'
				})
				console.log(res)
				this.swipers = res.message;
			}
		}
	}
</script>

<style lang="scss">
	.home{
		swiper{
			width: 750rpx;
			height: 380rpx;
			image{
				width: 100%;
				height: 100%;
			}
		}
	}
	.nav{
		display: flex;
		.nav_item{
			width: 25%;
			text-align: center;
			view{
				width: 120rpx;
				height: 120rpx;
				background: #b50e03;
				border-radius: 60rpx;
				margin: 10px auto;
				line-height: 120rpx;
				color: #fff;
				font-size: 50rpx;
			}
			.icon-tupian{
				font-size: 45rpx;
			}
			text{
				font-size: 30rpx;
			}
		}
	}
</style>
